<?php
/**
 * Note: *
 */

namespace App\Http\Controllers\Web;

use App\Handlers\WechatEventMessageHandler;
use App\Http\Controllers\Controller;
use EasyWeChat\Kernel\Messages\Message;
use Overtrue\LaravelWeChat\Facade as EasyWeChat;

class WechatController extends Controller
{
    /**
     * 微信通知回调
     * @return \Symfony\Component\HttpFoundation\Response
     // * @throws \EasyWeChat\Kernel\Exceptions\BadRequestException
     // * @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException
     // * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
     * @throws \ReflectionException
     */
    public function notify(): \Symfony\Component\HttpFoundation\Response
    {
        $app = EasyWeChat::officialAccount();
        $app->server->push(WechatEventMessageHandler::class, Message::EVENT);
        return $app->server->serve();
    }
}
